﻿
@model IEnumerable<CubicFWNet.Data.Models.MaterialFormat>
@{
    Layout = "~/Views/Shared/_InfoPage.cshtml";
}

<section class="content">
    <div class="form-horizontal">
        <div class="box box-solid">
            <div class="box-body">
                <form method="post" id="formMain">
                    <div class="row">
                        <input type="hidden" name="PID" value="@ViewBag.PID " />

                        <div class="form-group col-md-4 col-sm-12">
                            <label for="Width" class="col-sm-3 control-label">宽度mm</label>
                            <div class="col-sm-9">
                                <input type="number" class="form-control" id="Width" name="Width" maxlength="50" value="1">
                            </div>
                        </div>

                        <div class="form-group col-md-4 col-sm-12">
                            <label for="Length" class="col-sm-3 control-label">长度mm</label>
                            <div class="col-sm-9">
                                <input type="number" class="form-control" id="Length" name="Length" maxlength="50" value="1">
                            </div>
                        </div>
                   
                        <div class="form-group col-md-4 col-sm-12">
                            <label for="Memo" class="col-sm-3 control-label">备注</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Memo" name="Memo" maxlength="50">
                            </div>
                        </div>
                        <div class="form-group col-md-4 col-sm-12">
                            <label for="Number" class="col-sm-3 control-label"></label>
                            <div class="col-sm-9">
                                <span class="btn btn-primary " onclick="FormSub()">添加规格</span>&nbsp;&nbsp;&nbsp;&nbsp;
                                <label style="color:red">@ViewBag.Info</label>
                            </div>

                        </div>
                    </div>
                </form>
                <br />
                <table class="footable table table-stripped table-bordered table-hover" id="footable" data-page-size="20" data-filter=#filter>
                    <thead>
                        <tr>
                            <th data-sort-ignore="true">
                                规格
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                宽度MM
                            </th>
                            <th data-sort-ignore="true">
                                长度MM
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                备注
                            </th>
                            <th data-sort-ignore="true">
                                操作
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (null != Model)
                        {
                            foreach (var item in Model)
                            {
                                <tr>
                                    <td>
                                        @item.Format
                                    </td>
                                    <td>
                                        @item.Width
                                    </td>
                                    <td>
                                        @item.Length
                                    </td>
                                    <td>
                                        @item.Memo

                                    </td>
                                </tr>
                            }
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>

<script>
    function FormSub() {
        var length = $("#Length").val().trim();
        if (length == "") {
            $.modalAlert("请输入长度", "warning");
            return false;
        }

        var width = $("#Width").val().trim();
        if (width == "") {
            $.modalAlert("请输入宽度", "warning");
            return false;
        }

        $("#formMain").submit();
    }
</script>